package com.itheima02;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

public class DruidTest02 {
    public static void main(String[] args) throws Exception{
        Connection con = DataSourceUtils.getConnection();
        String sql = "select * from student where sid=?";
        PreparedStatement ps = con.prepareStatement(sql);
        ps.setObject(1,3);
        ResultSet res = ps.executeQuery();
        if(res.next()){
            System.out.println(res.getInt("sid") + "\t" + res.getString("name") + "\t" + res.getInt("age") + "\t" + res.getDate("birthday"));
        }
        DataSourceUtils.close(res,ps,con);
    }
}
